package client_gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import client_controllers.EmployeeLoginController;
import client_controllers.InitiateMarketingController;
import client_controllers.MarketingManagerController;
import net.miginfocom.swing.MigLayout;

import javax.swing.JButton;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class InitiateMarketingGUI extends JFrame {

	private JPanel contentPane;
	private JButton btnBack;
	private JButton btnInitiate ;
	private JComboBox comboBox;
	private JLabel lblCampaignPattern;
	private JLabel lblStartDate;
	private JLabel lblEndDate;
	private JTextField startDate;
	private JTextField endDate;
	private JLabel lblName;
	private JLabel lblCampaignId;
	private JTextField campaignId;
	private JTextField mcName;
	private JLabel lblMsg;
	private JComboBox salesman;
	private JLabel lblSalesMan;
	private JComboBox customers;
	private JLabel lblCustomer;
	private JLabel lblcustomers;
	private JButton btnCombine;
	/**
	 * @class InitiateMarketingGUI used by marketing manager to start a campaign.
	 */

	public InitiateMarketingGUI(MarketingManagerController mmc,
			EmployeeLoginController elc) {
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 700, 300);
		this.setTitle("Initiate marketing campaign");
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new MigLayout("", "[][][grow][][][][grow][][grow][][][]", "[][][][][][][][][][]"));
		
		lblCampaignId = new JLabel("campaign id ");
		contentPane.add(lblCampaignId, "cell 1 1,alignx trailing");
		
		campaignId = new JTextField();
		contentPane.add(campaignId, "cell 2 1,growx");
		campaignId.setColumns(10);
		
		lblMsg = new JLabel("msg");
		contentPane.add(lblMsg, "cell 5 1");
		lblMsg.setVisible(false);
		
		lblName = new JLabel("mcName");
		contentPane.add(lblName, "cell 1 2");
		
		mcName = new JTextField();
		contentPane.add(mcName, "cell 2 2,growx");
		mcName.setColumns(10);
		
		lblCampaignPattern = new JLabel("campaign pattern");
		contentPane.add(lblCampaignPattern, "cell 1 3,alignx trailing");
		
		comboBox = new JComboBox();
		contentPane.add(comboBox, "cell 2 3,growx");
		
		btnBack = new JButton("Back");
		contentPane.add(btnBack, "cell 11 3");
		
		lblStartDate = new JLabel("start date");
		contentPane.add(lblStartDate, "cell 1 4,alignx trailing");
		
		startDate = new JTextField();
		contentPane.add(startDate, "cell 2 4,growx");
		startDate.setColumns(10);
		
		lblEndDate = new JLabel("end date");
		contentPane.add(lblEndDate, "cell 1 5,alignx trailing");
		
		endDate = new JTextField();
		contentPane.add(endDate, "cell 2 5,growx");
		endDate.setColumns(10);
		
		lblSalesMan = new JLabel("sales man");
		contentPane.add(lblSalesMan, "cell 6 5");
		
		lblCustomer = new JLabel("customer");
		contentPane.add(lblCustomer, "cell 8 5");
		
		lblcustomers = new JLabel("#customers:");
		contentPane.add(lblcustomers, "cell 9 5");
		
		salesman = new JComboBox();
		contentPane.add(salesman, "cell 6 6,growx");
		
		customers = new JComboBox();
		contentPane.add(customers, "cell 8 6,growx");
		
		btnCombine = new JButton("combine");
		contentPane.add(btnCombine, "cell 7 7");
		btnCombine.setEnabled(false);
		
		btnInitiate = new JButton("initiate");

		contentPane.add(btnInitiate, "cell 1 9");
		
		this.setVisible(true);
		InitiateMarketingController imc = new InitiateMarketingController(this,mmc,elc);
	}
	public JComboBox getComboBox() {
		return comboBox;
	}
	public JTextField getStartDate() {
		return startDate;
	}
	public JTextField getEndDate() {
		return endDate;
	}
	public JTextField getCampaignId() {
		return campaignId;
	}
	
	public JTextField getMcName() {
		return mcName;
	}
	public void setComboBox(JComboBox comboBox) {
		this.comboBox = comboBox;
	}
	public void setStartDate(JTextField startDate) {
		this.startDate = startDate;
	}
	public void setEndDate(JTextField endDate) {
		this.endDate = endDate;
	}
	public void setCampaignId(JTextField campaignId) {
		this.campaignId = campaignId;
	}
	public void setMcName(JTextField mcName) {
		this.mcName = mcName;
	}
	public JButton getBtnBack() {
		return btnBack;
	}
	public JButton getBtnInitiate() {
		return btnInitiate;
	}
	public void setBtnBack(JButton btnBack) {
		this.btnBack = btnBack;
	}
	public void setBtnInitiate(JButton btnInitiate) {
		this.btnInitiate = btnInitiate;
	}
	public JLabel getLblMsg() {
		return lblMsg;
	}
	public void setLblMsg(JLabel lblMsg) {
		this.lblMsg = lblMsg;
	}
	public JComboBox getSalesman() {
		return salesman;
	}
	public JComboBox getCustomers() {
		return customers;
	}
	public JLabel getLblcustomers() {
		return lblcustomers;
	}
	public void setSalesman(JComboBox salesman) {
		this.salesman = salesman;
	}
	public void setCustomers(JComboBox customers) {
		this.customers = customers;
	}
	public void setLblcustomers(JLabel lblcustomers) {
		this.lblcustomers = lblcustomers;
	}
	public JButton getBtnCombine() {
		return btnCombine;
	}
	public void setBtnCombine(JButton btnCombine) {
		this.btnCombine = btnCombine;
	}
	
	

}
